<?php

$page_title = "Birthdays";
$rank_check = 0;
include "header.inc.php";

$bdayQ = mysql_query("SELECT * FROM members_profiles2 WHERE game = '$game' AND (birthday LIKE '%$datestamp3%' OR birthday LIKE '%$datestamp4%')");
$numBdays = mysql_num_rows($bdayQ);
while ($getUsersOn = mysql_fetch_array($bdayQ))
{
	$getMember = fetch("SELECT * FROM members2 WHERE username = '$getUsersOn[username]' AND game = '$game'");
	$id = $getMember[id];

	$xplBday = explode("-", $getUsersOn[birthday]);
	$age[$id] = $this_year - $xplBday[2];

	if ($getUsersOn[gender] == 2) { $gender = "<img src=images/icons/male.gif>"; }
	if ($getUsersOn[gender] == 1) { $gender = "<img src=images/icons/female.gif>"; }
	if ($getUsersOn[gender] == 0) { $gender = "<img src=images/icons/undecided.gif>"; }

	if ($getUsersOn[mail_settings] == 1) { $mail[$id] = "<a href=mail_send.php?game=$game&send_to=$getMember[username]><img src=images/icons/mail.gif></a>"; }
	if ($getUsersOn[mail_settings] == 0) { $mail[$id] = "<a href=mail_send.php?game=$game&send_to=$getMember[username]><img src=images/icons/mail.gif></a>"; }

	$bud[$id] = "<a href=buds.php?game=$game&bud=$getMember[username]><img src=images/icons/bud.gif></a>";

		$listUsersOn .= "<tr><td valign=right><a 	href=$base_url/user_profile.php?game=$game&user=$getMember[username]>$getMember[display_name]</a> 	<i>turned <b>$age[$id]</b></i></td>
		<td width=14>$gender</td>
		<td width=14>$mail[$id]</td>
		<td width=14>$bud[$id]</td>
		</tr>";
}

if ($popup == "true") { print "<html><head><title>$page_title</title></head><body bgcolor=$reallyLight>"; $popupLink = " TARGET=_blank"; }
if ($popup != "true") { print "$openHTML"; }

ECHO <<<END

<br><br>
<P align=center><TABLE BGCOLOR="$topAndBottomBG" CELLSPACING=1 CELLPADDING=0 WIDTH=500>
   <TR>
      <TD HEIGHT=50>
         <CENTER><FONT SIZE="+3" COLOR="$topAndBottomText"><B>$numBdays Birthdays Today!</B></FONT></CENTER>
      </TD>
   </TR>
   <TR BGCOLOR="$maincellColor">
      <TD>
         <CENTER>
         <table>
         $listUsersOn
      	 </table>
      </TD>
   </TR>
</TABLE>
</P>
<br>

END;

if ($popup != "true") { print "$closeHTML"; }
if ($popup == "true") { print "<p align=center>&copy;</p></body></html>"; }
?>